package com.ssm.common;


public class Result<T> {
    Integer code;
    String msg;
    T data;

    public Result(Integer code,String msg,T data){
        this.code=code;
        this.msg=msg;
        this.data=data;
    }

    /**
     * 成功;
     * @return  返回成功的结果集;
     */
    public static Result success(String message,Object data){
        return new Result(200,message,data);
    }
    public static Result success(Integer code,String message,Object data){
        return new Result(code,message,data);
    }

    /**
     *失败;
     * @return 返回错误的结果集;
     */
    public static Result fail(String message,Object data){
        return new Result(500,message,data);
    }
    public static Result fail(Integer code,String message,Object data){
        return new Result(code,message,data);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Result(){

    }
}

